package com.yehongyu.mytools.basic.grammar;

public class Java006_Override2 extends QA001_OverrideParent {
	private final String color;

	public Java006_Override2(int x, int y, String color) {
		super(x, y);
		this.color = color;
	}

	protected String makeDescription() {
		return super.makeDescription() + " --- " + color;
	}

	public static void main(String[] args) {
		System.out.println(new Java006_Override2(4, 2, "white"));
	}
}

class QA001_OverrideParent {

	protected final int x, y;
	private final String description;

	public QA001_OverrideParent(int x, int y) {
		this.x = x;
		this.y = y;
		this.description = makeDescription();
	}

	public final String toString() {
		return description;
	}

	protected String makeDescription() {
		return "[" + x + ", " + y + "]";
	}
}